let initData = {
    age:"20",
    name1:"zhanGSAN",
    arr:[]
}
let appReducer = (state = initData,action)=>{
    console.log(action,7777)
    if (action.type == "setAge") {
        return {
            ...state,
            age:action.payload
        }
    }
    if (action.type == "setArr") {
        return {
            ...state,
            arr:action.payload
        }
    }

    return {
        ...state 
    }
}
export default appReducer
// state 定义数据，action修改数据，但是action需要dispatch来触发
// 修改state唯一途径是通过action
// distach 是用来触发action的